import java.util.ArrayList;
import java.util.List;

/**
 * @author LKQ
 * @date 2022/2/2 16:24
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {1,1,1,0,1};
        solution.prefixesDivBy5(nums);
    }
    public List<Boolean> prefixesDivBy5(int[] nums) {
        List<Boolean> list = new ArrayList<>(nums.length);
        int ans = 0;
        for (int num: nums) {
            // 保留余数，不要保留值
            ans = (ans * 2 + num) % 5;
            list.add(ans == 0);
        }
        return list;
    }
}
